<?//=$this->css("styles/impressions.css")?>
<style>
#pdf h2{
	border-left: 5px solid gray;
	border-bottom: 1px dotted gray;
	padding-left: 5px;	
}
#pdf table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid #AAA;	
}
#pdf th {
	background: #DDD;
	padding-top:3px;
	padding-bottom:3px;
	text-align:center;
}
#pdf td {
	border: 1px solid #DDD;

}
#pdf {
	
}
</style>
<div id="pdf">
<h2> Livre des achats </h2>
<i> Période du <?=$_POST["date_deb"]?> au <?=$_POST["date_fin"]?></i> <br/> <br/>
<table style="width:30cm">
	<tr>
		<th style="width:12%"> Date de la facture </th>
		<th style="width:50%"> Fournisseur </th>
		<th style="width:10%"> Montant TTC </th>
		<th style="width:10%"> Montant TVA </th>
		<th style="width:12%"> Date du paiement </th>
	</tr>
	<?foreach($factures as $facture){
		$totTTC += $facture->montant_ttc;
		$totTVA += ($facture->montant_55+$facture->montant_196);
	?>
	<tr>
		<td style="text-align:center;"><?=date("d-m-Y",strtotime($facture->date))?></td>
		<td><?=$facture->fournisseur?></td>
		<td style="text-align:center;"><?=$facture->montant_ttc?> &euro;</td>
		<td style="text-align:center;"><?=$facture->montant_55+$facture->montant_196?> &euro;</td>
		<td style="text-align:center;"> <?=(!is_null($facture->paiement))?date("d-m-Y",strtotime($facture->paiement->date)):""?></td>
	</tr>
	<?}?>
	<tr>
		<td colspan="2" style="font-weight:bold;text-align:right;border-left:1px solid #FFF;border-bottom:1px solid #FFF;padding-right:5px;"> Total : </td>
		<td style="text-align:center;font-weight:bold;"> <?=$totTTC?> &euro; </td>
		<td style="text-align:center;font-weight:bold;"> <?=$totTVA?> &euro; </td>
		<td style="border-bottom:1px solid #FFF;border-right:1px solid #FFF;"></td>
	</tr>
</table>
</div>